Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skips Namespace deletion on installlerSet deletion #565

Merged
merged 1 commit into from
Dec 20, 2021

Conversation

sm43
Copy link
Member

@sm43 sm43 commented Dec 20, 2021

Previoulsy, if we delete an installerSet with Namespace eg pipelines
it would delete ns too which means it would delete resources from other
installerSet and the other installerSet will try to recreate it. so it
might corrupt the resources.

this update the installerSet to skip the deletion and update the owner of namespace to
the owner of installerSet which means namespace will be deleted when TektonPipeline CR
is deleted and not when its installerSet is deleted.

this also updates the deletion flow in finalizer of TektonConfig.
delete the resources in the reverse way of creation.
so delete platform specific first then triggers and then pipelines.

Signed-off-by: Shivam Mukhade [email protected]

Changes

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

See the contribution guide for more details.

Release Notes

Previoulsy, if we delete an installerSet with Namespace eg pipelines
it would delete ns too which means it would delete resources from other
installerSet and the other installerSet will try to recreate it. so it
might corrupt the resources.

this update the installerSet to skip the deletion and update the owner of namespace to
the owner of installerSet which means namespace will be deleted when TektonPipeline CR
is deleted and not when its installerSet is deleted.

this also updates the deletion flow in finalizer of TektonConfig.
delete the resources in the reverse way of deletion.
so delete platform specific first then triggers and then pipelines.

Signed-off-by: Shivam Mukhade <[email protected]>
@tekton-robot tekton-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Dec 20, 2021
@tekton-robot tekton-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Dec 20, 2021
@tekton-robot
Copy link
Contributor

The following is the coverage report on the affected files.
Say /test pull-tekton-operator-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/kubernetes/tektoninstallerset/transformer.go 85.7% 86.7% 1.0

if original.Spec.Profile == v1alpha1.ProfileLite {
return pipeline.TektonPipelineCRDelete(ctx, r.operatorClientSet.OperatorV1alpha1().TektonPipelines(), v1alpha1.PipelineResourceName)
} else {
// TektonPipeline and TektonTrigger is common for profile type basic and all
if err := pipeline.TektonPipelineCRDelete(ctx, r.operatorClientSet.OperatorV1alpha1().TektonPipelines(), v1alpha1.PipelineResourceName); err != nil {
if err := trigger.TektonTriggerCRDelete(ctx, r.operatorClientSet.OperatorV1alpha1().TektonTriggers(), v1alpha1.TriggerResourceName); err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this change 🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to delete in the reverse order of resource creation
as deleting TektonPipeline will delete namespace
we delete dashboard, triggers and then pipelines
just to make all resource get deleted in a cleaner way

Copy link
Contributor

@pradeepitm12 pradeepitm12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Dec 20, 2021
@vdemeester
Copy link
Member

/approve

@tekton-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: pradeepitm12, vdemeester

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 20, 2021
@tekton-robot tekton-robot merged commit 17f2087 into tektoncd:main Dec 20, 2021
@sm43 sm43 deleted the handle-ns-deletion branch August 19, 2022 05:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants